<?php
	header("Content-type:text/html;charset=utf-8");
	include "Model.php";
	echo "<pre>";
	$connn =new Mysql('preferredshares','oc_admin_user');
    $sql = 'select id, user_type,avatar as avatar_img ,province,city,town as district,nickname as nick_name,username as user_name,password as user_password,truename as true_name,sex, mobile,idcard as id_card ,unionid as wx_union_id, openid1 as wx_open_id ,recommender as recommend_user ,recommendedphone as recommend_mobile ,create_time,update_time from  oc_admin_user ;';
    $res =$connn->getAll($sql);
    $conn1 =  new Mysql('preferredshares','client_info'); 
    //var_dump($res);
	foreach ($res as $k =>$v){
        $data =array();
        $data['id']              = $v['id'];
        $data['user_type']       = $v['user_type'];
        $data['avatar_img']      = $v['avatar_img'];
        $data['province']        = $v['province'];
        $data['city']            = $v['city'];
        $data['district']        = $v['district'];
        $data['nick_name']       = addslashes($v['nick_name']);
        $data['true_name']       = $v['true_name'];
        $data['user_name']       = $v['user_name'];
        $data['user_password']   = $v['user_password'];
        $data['sex']             = $v['sex'];
        $data['mobile']          = $v['mobile'];
        $data['id_card']         = $v['id_card'];
        $data['wx_union_id']     = $v['wx_union_id'];
        $data['wx_open_id']      = $v['wx_open_id'];
        $data['recommend_user']  = $v['recommend_user'];
        $data['recommend_mobile']= $v['recommend_mobile'];
        $data['create_time']     = $v['create_time']==0 ? Null:date('Y-m-d H:i:s',$v['create_time']);
        $data['update_time']     = $v['update_time']==0 ? Null:date('Y-m-d H:i:s',$v['update_time']);
       
        //var_dump($data);
        //exit;
        $res=$conn1->insert($data);
    }
    echo '<script>alert("插入数据库成功")</script>';
